This repository has been archived by the owner on Dec 22, 2022. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Computes the k-core value for all vertices in the input graph. A k-core is a maximal subgraph in which all vertices have degree >= k. A vertex’s k-core value is the largest value of k for which it is a member of a k-core.
This implementation is intended for undirected graphs. For directed graphs, there are concepts of directional k-core values based on vertices' in- and out-degrees, but I have not yet implemented that.
How it works:
To find the k-cores, start with the full graph and set k=iteration. Then iteratively remove vertices (mark them as deleted) with degree <= k, set those vertices’ k-core values to the current value of k, and decrement the degree for all neighbor vertices. Increment k when all vertices with degree <= k have been removed. Repeat the vertex removal process. Continue until no vertices remain.
There are some differences in results between this and k-core app in
gunrock/gunrock
, which come from differences in the graph pre-processing; specifically, directed graphs and self-loops. Graphs that are symmetric and contain no self-loops have same k-core results foressentials
andgunrock/gunrock
. Graphs that are not symmetric and/or include self-loops will have different results, because the reported vertex degrees differ in the two graph implementations.